package com.puny.mvc.controllers
{
	import com.puny.mvc.MvcEvent;
	import com.puny.mvc.views.EmbededView;
	import com.puny.mvc.views.SampleView;
	import com.puny.mvc.views.View;
	
	import flash.events.Event;
	
	public class SampleController extends Controller
	{
		private var _checker:int = 0;
		public function SampleController()
		{
			super();
		}
		
		override protected function setup():void {
			addChild(new SampleView());
			var view:View = new EmbededView();
			view.addEventListener(MvcEvent.COMPLETED, completeHandler);
			addChild(view);
		}
		
		override protected function beforeReady():void {
		}
		
		private function completeHandler(event:Event):void {
			complete();
		}
		
		public function get checker():int {
			return _checker;
		}
		
		override protected function afterReady():void {
			_checker++;
		}
		
		override protected function beforeClose():void {
			_checker++;	
		}
		
		override protected function afterClose():void {
			_checker++;
		}
		override protected function beforeChildrenRemoved():void {
			_checker++;
		}	
		
		override protected function afterChildrenRemoved():void {
			_checker++;
		}	
	}
}